###############################################
# XENOMORPH ESPIONAGE OPERATIONS
# Pass 24: 6 Xenomorph-exclusive operations. ADDITIONS to vanilla.
###############################################

@diff_t1 = 5
@diff_t3 = 7
@diff_t5 = 9
@diff_t6 = 10
@diff_t9 = 13
@xeno_op_timer = 10800


operation_xenomorph_biological_survey = {
	target = none
	categories = { op_cat_subterfuge op_cat_economy }
	picture = GFX_evt_spymaster
	desc = operation_xenomorph_biological_survey_desc
	stages = 2

	resources = {
		category = operations
		cost = { influence = 20 }
		upkeep = { energy = 4 }
	}

	spy_power_cost = 15

	potential = {
		owner = {
			xeno_is_xenomorph_hive_country = yes
			has_tradition = tr_xenomorph_silent_infestation_pheromone_masks
		}
		target = { is_country_type = default }
	}

	allow = {
		custom_tooltip = {
			is_running_espionage_operation = no
			fail_text = operation_one_at_a_time
		}
	}

	stage = {
		difficulty = @diff_t1
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.1
	}
	stage = {
		difficulty = @diff_t1
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.2
	}

	on_create = {
		target = {
			set_timed_country_flag = {
				flag = espionage_operation_targeted_by@root.owner
				days = @xeno_op_timer
			}
		}
	}
}


operation_xenomorph_seed_infestation = {
	target = none
	categories = { op_cat_infiltration op_cat_economy }
	picture = GFX_evt_alien_artifacts
	desc = operation_xenomorph_seed_infestation_desc
	stages = 3

	resources = {
		category = operations
		cost = { influence = 50 }
		upkeep = { energy = 8 }
	}

	spy_power_cost = 40

	potential = {
		owner = {
			xeno_is_xenomorph_hive_country = yes
			has_tradition = tr_xenomorph_silent_infestation_abduction_protocols
		}
		target = { is_country_type = default }
	}

	allow = {
		custom_tooltip = {
			is_running_espionage_operation = no
			fail_text = operation_one_at_a_time
		}
	}

	stage = {
		difficulty = @diff_t3
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.10
	}
	stage = {
		difficulty = @diff_t3
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.11
	}
	stage = {
		difficulty = @diff_t3
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.12
	}

	on_create = {
		target = {
			set_timed_country_flag = {
				flag = espionage_operation_targeted_by@root.owner
				days = @xeno_op_timer
			}
		}
	}
}


operation_xenomorph_brood_swap = {
	target = none
	categories = { op_cat_sabotage op_cat_economy }
	picture = GFX_evt_alien_artifacts
	desc = operation_xenomorph_brood_swap_desc
	stages = 4

	resources = {
		category = operations
		cost = { influence = 80 }
		upkeep = { energy = 10 }
	}

	spy_power_cost = 60

	potential = {
		owner = {
			xeno_is_xenomorph_hive_country = yes
			has_technology = tech_xenomorph_op_brood_swap
		}
		target = { is_country_type = default }
	}

	allow = {
		custom_tooltip = {
			is_running_espionage_operation = no
			fail_text = operation_one_at_a_time
		}
	}

	stage = {
		difficulty = @diff_t5
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.20
	}
	stage = {
		difficulty = @diff_t5
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.21
	}
	stage = {
		difficulty = @diff_t5
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.22
	}
	stage = {
		difficulty = @diff_t5
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.23
	}

	on_create = {
		target = {
			set_timed_country_flag = {
				flag = espionage_operation_targeted_by@root.owner
				days = @xeno_op_timer
			}
		}
	}
}


operation_xenomorph_implantation_program = {
	target = none
	categories = { op_cat_infiltration op_cat_government }
	picture = GFX_evt_alien_artifacts
	desc = operation_xenomorph_implantation_program_desc
	stages = 5

	resources = {
		category = operations
		cost = { influence = 100 }
		upkeep = { energy = 12 }
	}

	spy_power_cost = 80

	potential = {
		owner = {
			xeno_is_xenomorph_hive_country = yes
			has_technology = tech_xenomorph_op_implantation
		}
		target = { is_country_type = default }
	}

	allow = {
		custom_tooltip = {
			is_running_espionage_operation = no
			fail_text = operation_one_at_a_time
		}
	}

	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.30
	}
	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.31
	}
	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.32
	}
	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.33
	}
	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.34
	}

	on_create = {
		target = {
			set_timed_country_flag = {
				flag = espionage_operation_targeted_by@root.owner
				days = @xeno_op_timer
			}
		}
	}
}


operation_xenomorph_brood_uprising = {
	target = none
	categories = { op_cat_provocation op_cat_government }
	picture = GFX_evt_alien_artifacts
	desc = operation_xenomorph_brood_uprising_desc
	stages = 5

	resources = {
		category = operations
		cost = { influence = 120 }
		upkeep = { energy = 15 }
	}

	spy_power_cost = 100

	potential = {
		owner = {
			xeno_is_xenomorph_hive_country = yes
			has_technology = tech_xenomorph_op_brood_uprising
		}
		target = { is_country_type = default }
	}

	allow = {
		custom_tooltip = {
			is_running_espionage_operation = no
			fail_text = operation_one_at_a_time
		}
	}

	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.40
	}
	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.41
	}
	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.42
	}
	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.43
	}
	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.44
	}

	on_create = {
		target = {
			set_timed_country_flag = {
				flag = espionage_operation_targeted_by@root.owner
				days = @xeno_op_timer
			}
		}
	}
}


operation_xenomorph_planetary_consumption = {
	target = none
	categories = { op_cat_sabotage op_cat_economy }
	picture = GFX_evt_alien_artifacts
	desc = operation_xenomorph_planetary_consumption_desc
	stages = 7

	resources = {
		category = operations
		cost = { influence = 200 }
		upkeep = { energy = 20 }
	}

	spy_power_cost = 150

	potential = {
		owner = {
			xeno_is_xenomorph_hive_country = yes
			has_technology = tech_xenomorph_op_planetary_consumption
		}
		target = { is_country_type = default }
	}

	allow = {
		custom_tooltip = {
			is_running_espionage_operation = no
			fail_text = operation_one_at_a_time
		}
	}

	stage = {
		difficulty = @diff_t9
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.50
	}
	stage = {
		difficulty = @diff_t9
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.51
	}
	stage = {
		difficulty = @diff_t9
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.52
	}
	stage = {
		difficulty = @diff_t9
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.53
	}
	stage = {
		difficulty = @diff_t9
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.54
	}
	stage = {
		difficulty = @diff_t9
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.55
	}
	stage = {
		difficulty = @diff_t9
		icon = GFX_espionage_chapter_icon_document
		event = xenomorph_op.56
	}

	on_create = {
		target = {
			set_timed_country_flag = {
				flag = espionage_operation_targeted_by@root.owner
				days = @xeno_op_timer
			}
		}
	}
}


# =============================================
# 3_61 D3 PORT — from dead common/espionage_operations/ (fake schema).
# Chances from the dead records (raid 55/20, cell 45/30) drive the
# outcome random_lists in the final-stage events. Gates [VETO].
# =============================================

operation_xenomorph_raid_pop = {
	target = none
	categories = { op_cat_subterfuge }
	picture = GFX_evt_spymaster
	desc = operation_xenomorph_raid_pop_desc
	stages = 2

	resources = {
		category = operations
		cost = { energy = 200 influence = 25 }
		upkeep = { energy = 4 }
	}

	spy_power_cost = 25

	potential = {
		owner = {
			xeno_is_xenomorph_hive_country = yes
			has_tradition = tr_xenomorph_silent_infestation_abduction_protocols
		}
		target = {
			is_country_type = default
			any_owned_planet = { num_pops >= 5 }
		}
	}

	allow = {
		custom_tooltip = {
			is_running_espionage_operation = no
			fail_text = operation_one_at_a_time
		}
	}

	stage = {
		difficulty = @diff_t5
		icon = GFX_espionage_chapter_icon_intrigue
		event = xenomorph_op.60
	}
	stage = {
		difficulty = @diff_t6
		icon = GFX_espionage_chapter_icon_skull
		event = xenomorph_op.61
	}

	on_create = {
		target = {
			set_timed_country_flag = {
				flag = espionage_operation_targeted_by@root.owner
				days = @xeno_op_timer
			}
		}
	}
}

operation_xenomorph_hive_cell = {
	target = none
	categories = { op_cat_subterfuge }
	picture = GFX_evt_spymaster
	desc = operation_xenomorph_hive_cell_desc
	stages = 2

	resources = {
		category = operations
		cost = { energy = 300 influence = 50 }
		upkeep = { energy = 4 }
	}

	spy_power_cost = 30

	potential = {
		owner = {
			xeno_is_xenomorph_hive_country = yes
			has_tradition = tr_xenomorph_silent_infestation_blacksite_cells
		}
		target = {
			is_country_type = default
			any_owned_planet = { num_pops >= 8 }
		}
	}

	allow = {
		custom_tooltip = {
			is_running_espionage_operation = no
			fail_text = operation_one_at_a_time
		}
	}

	stage = {
		difficulty = @diff_t5
		icon = GFX_espionage_chapter_icon_intrigue
		event = xenomorph_op.70
	}
	stage = {
		difficulty = @diff_t9
		icon = GFX_espionage_chapter_icon_skull
		event = xenomorph_op.71
	}

	on_create = {
		target = {
			set_timed_country_flag = {
				flag = espionage_operation_targeted_by@root.owner
				days = @xeno_op_timer
			}
		}
	}
}
